#include "gtest/gtest.h"


#include "helper/watch/ChronoClock.h"

using namespace helper;
using namespace watch;


using namespace std::chrono_literals;
TEST(ChronoClockTest, testIf){
	//typedef std::chrono::duration<double> Duration; //OK
    //typedef std::chrono::nanoseconds Duration;  //OK
    //typedef std::chrono::microseconds Duration; //OK
    //typedef std::chrono::milliseconds Duration; 
    //typedef std::chrono::seconds Duration;
    ChronoClock<std::chrono::steady_clock> clock;

    ASSERT_EQ(0, clock.init().time_since_epoch().count());

    helper::watch::Timespan<ChronoClock<>::TimePoint> ts(clock.now(), clock.init());
    int sum = 0;
    for(long long  i = 0; i < 1000*1000; i++){
        sum += 100;
    }
    ts.end = clock.now();
    ASSERT_TRUE(clock.diff(ts) < 7ms); //< 0.06 second
    //std::cout << clock.diff(ts).count() << std::endl;
}


